import os
import warnings
import pandas as pd

warnings.filterwarnings("ignore")
path = 'D:/Projects/PycharmProjects/DataA'
dirD = {}
for i in os.listdir(path):
    dirD[i] = 0

data2 = pd.read_excel("criteria3.xlsx")

lst = []


# 加分
def addScore(p):
    for j in os.listdir(path + '/' + p + "/task3.xlsx"):
        if j == 'task3.xlsx':
            data = pd.read_excel(path + p + "/" + j)

            # 判断维数
            if data.shape == data2.shape:
                # 算分
                dirD[p] += 5


errors = []
for i in os.listdir(path):
    addScore(i)
df = pd.DataFrame([(i, j) for i, j in zip(*[dirD.keys(), dirD.values()])], columns=["作品号", "得分"])
df.to_excel("summary/result3_1.xlsx", index=False)
